<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class _reservaM extends CI_Model {

    public function __construct() {
        $this->load->database();
    }

    // S E L E C T
    public function get($id) {
        $query = "SELECT * FROM reserva WHERE id_reserva='$id'";
        return $this->db->query($query)->result();
    }

    public function get_fecha($establecimiento, $tipo, $fecha) {
        $query = "SELECT * FROM reserva WHERE id_establecimiento='$establecimiento' AND date_format(fecha_{$tipo}, '%d/%m/%Y') = '{$fecha}'";
        //echo $query;
        return $this->db->query($query)->result();
    }

    // U P D A T E 
    // D E L E T E
}